package PlgTest

import (
	"dgo/goutils/gohttp"
	"dgo/plg/plgbase"
	"gitee.com/ymofen/supervalue"
	"testing"
	"time"
)

func PlgTestFromConf(confstr string, t *testing.T) interface{} {
	gohttp.CheckDefaultHttpServeMux("/")
	json, err := wrapper.NewSVFromBuf([]byte(confstr))
	if err != nil {
		t.Error(err)
		return nil
	}

	_, _, err = plgbase.PlgCheckReloadFromJSONStr(confstr)
	if err != nil {
		t.Error(err)
		return nil
	}

	time.Sleep(time.Second)

	return plgbase.FindPluginByID(json.StringByName("id", ""))

}
